/**
 * ClassName: OrderServiceImpl
 * Package: org.example.service.impl
 * Description: 订单服务实现类-基于XML方式暴露服务
 *
 * @Author BCXJ
 * @Create 2025/10/6 02:15
 * @Version 1.0
 * @Since 1.0
 */
package org.example.service.impl;

import org.example.service.OrderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 订单服务实现类
 * 通过XML配置暴露服务
 */
public class OrderServiceImpl implements OrderService {
    
    private static final Logger logger = LoggerFactory.getLogger(OrderServiceImpl.class);
    
    /**
     * 根据订单ID获取订单信息
     * 
     * @param orderId 订单ID
     * @return 订单信息
     */
    @Override
    public String getOrderInfo(Long orderId) {
        logger.info("【OrderService-XML方式】接收到请求: getOrderInfo, orderId={}", orderId);
        
        // 模拟数据库查询订单信息
        String orderInfo = "订单ID: " + orderId + ", 订单状态: 已完成, 订单金额: ¥299.00";
        
        logger.info("【OrderService-XML方式】返回结果: {}", orderInfo);
        return orderInfo;
    }
    
    /**
     * 创建订单
     * 
     * @param userId 用户ID
     * @param productId 产品ID
     * @return 订单创建结果
     */
    @Override
    public String createOrder(Long userId, Long productId) {
        logger.info("【OrderService-XML方式】接收到请求: createOrder, userId={}, productId={}", userId, productId);
        
        // 模拟创建订单逻辑
        Long orderId = System.currentTimeMillis();
        String result = "订单创建成功！订单ID: " + orderId + ", 用户ID: " + userId + ", 产品ID: " + productId;
        
        logger.info("【OrderService-XML方式】返回结果: {}", result);
        return result;
    }
}

